/*------------------------------------------------------
                hou_elearningGEN beta v1.0
Author: xtrung.net@gmail.com
Write On: 04/27/2008
Create On:4/13/2012 11:22:48 AM
------------------------------------------------------*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using System.Runtime.Serialization;
namespace hou_elearning.Entity
{
    [DataContract]
    public class DiemdanhEntity
    {
        public DiemdanhEntity()
        {
            m_pk_idiemdanhid = 0;
			m_fk_itrangslideid=0;
			m_fk_ihocvienid=0;
            m_fk_ikhoahocid = 0;
			m_dthoidiemxem=DateTime.Now;
			m_itrangthai=1;
        }
        private Int64 m_pk_idiemdanhid;
        [DataMember]
        public Int64 PK_iDiemdanhID
        {
            get { return m_pk_idiemdanhid; }
            set { m_pk_idiemdanhid = value; }
        }
		private Int64 m_fk_itrangslideid;
        [DataMember]
		public Int64 FK_iTrangslideID
		{
			get { return m_fk_itrangslideid ; }
			set { m_fk_itrangslideid = value; }
		}
		private Int64 m_fk_ihocvienid;
        [DataMember]
		public Int64 FK_iHocvienID
		{
			get { return m_fk_ihocvienid ; }
			set { m_fk_ihocvienid = value; }
		}
        private Int64 m_fk_ikhoahocid;
        [DataMember]
        public Int64 FK_iKhoahocID
        {
            get { return m_fk_ikhoahocid; }
            set { m_fk_ikhoahocid = value; }
        }
		private DateTime m_dthoidiemxem;
        [DataMember(IsRequired=false)]
		public DateTime dThoidiemxem
		{
			get { return m_dthoidiemxem ; }
			set { m_dthoidiemxem = value; }
		}
		private Int16 m_itrangthai;
        [DataMember]
		public Int16 iTrangthai
		{
			get { return m_itrangthai ; }
			set { m_itrangthai = value; }
		}

        #region Comparison
        public static List<DiemdanhEntity> Sort(List<DiemdanhEntity> list, String SortExpression, String SortDirection)
        {
            string strComparisonAttrb="COMPARISON_"+SortExpression;
            PropertyInfo propInfo= typeof(DiemdanhEntity).GetProperty(strComparisonAttrb);
            if (propInfo != null)
            {
                list.Sort(propInfo.GetGetMethod().Invoke(null,null) as Comparison<DiemdanhEntity>);
                if (SortDirection == "DESC")
                    list.Reverse();
            }
            return list;
        }
        
		public static Comparison<DiemdanhEntity> COMPARISON_FK_iBaihocID
		{
			get
			{
				return delegate(DiemdanhEntity entity,DiemdanhEntity other)
				{
					return entity.FK_iTrangslideID.CompareTo(other.FK_iTrangslideID);
				};
			}
		}
		public static Comparison<DiemdanhEntity> COMPARISON_FK_iHocvienID
		{
			get
			{
				return delegate(DiemdanhEntity entity,DiemdanhEntity other)
				{
					return entity.FK_iHocvienID.CompareTo(other.FK_iHocvienID);
				};
			}
		}
		public static Comparison<DiemdanhEntity> COMPARISON_dThoidiemvaolop
		{
			get
			{
				return delegate(DiemdanhEntity entity,DiemdanhEntity other)
				{
					return entity.dThoidiemxem.CompareTo(other.dThoidiemxem);
				};
			}
		}
		public static Comparison<DiemdanhEntity> COMPARISON_iTrangthai
		{
			get
			{
				return delegate(DiemdanhEntity entity,DiemdanhEntity other)
				{
					return entity.iTrangthai.CompareTo(other.iTrangthai);
				};
			}
		}
        #endregion
    }
}
